exports.unInstallAggregationExtension = function (req, res) {

    //获取参数信息
    var bodyParams = req.routeInfo.bodyParams;

    //模块信息
    var moduleData = {};

    //任务流创建
    async.waterfall([


        (cb) => {

            //查询要卸载的模块信息
            R.SEND_HTTP(
                req,
                res,
                {
                    url: CORE_APIConfig.coreAPI.sysOrganizationalFunctionModuleSearch.Request_Api_Url + "/fm_id/" + bodyParams.fm_id,
                    method : 'GET'
                },
                function (data) {

                    moduleData = data.result.data[0];

                    //判断是否安装过
                    if(moduleData.fm_status == 0){
                        return RES.errorResponse(res, false, "抱歉，您还未安装过该模块");
                    }

                    cb()
                
                }
            )

        },

        //卸载扩展模块核心层处理
        (cb) => {

            R.SEND_HTTP(
                req,
                res,
                {
                    url: CORE_APIConfig.coreAPI.extensionApiUnInstallExtension.Request_Api_Url,
                    method : 'POST',
                    data   : bodyParams
                },
                function (data) {

                    cb()
                
                }
            )

        },
        
        //删除中间层相关目录以及文件
        (cb) => {

            var removeDir     = "./extension/routes/" + moduleData.fm_dir_name;
            var removeApi     = "./extension/api/extensionApi/" + moduleData.fm_dir_name + ".api.js";
            var removeCoreApi = "./extension/api/extensionCoreApi/" + moduleData.fm_dir_name + ".core.js";

            //卸载本地模块相关文件
            common.delDir(removeDir)
            common.unlinkFile(removeApi,()=>{})
            common.unlinkFile(removeCoreApi,()=>{})

            cb()
        }

    ], ()=> {

        //返回最终拼接结果
        RES.successResponse(res);

    });

}